<template>
  <div class="layout-all">
<el-table
        :data="tableData"
        stripe
        align="center"
        highlight-current-row
        style="width: 100%;margin-top:10px"
      >
        <el-table-column align="center" prop="id" label="序号" width="70" :fixed="isMobile()?'left':undefined"/>
        <el-table-column align="center" prop="ext_id" label="ID" />
        <el-table-column align="center" prop="create_time" label="日期"/>
        <el-table-column align="center" prop="remark" label="事项" />
        <el-table-column align="center" prop="action" label="类型" >
          
          <template slot-scope="scope">
            {{action_arr[scope.row.action]}}
          </template>
        </el-table-column>
        <el-table-column align="center" prop="before_amount" label="变更前金额" width="120"/>
        <el-table-column align="center" prop="amount" label="金额" width="120">
          <template slot-scope="scope">
            <el-tag :type="scope.row.amount<0?'danger':'success'"> {{scope.row.amount}}</el-tag>
          </template>
        </el-table-column>
      </el-table>

    <el-pagination
      :current-page="current_page"
      :page-size="per_page"
      layout="total, prev, pager, next, jumper"
      :total="total"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
    />
  </div>
</template>

<script>
import control from "../../components/control/control";
export default {
  props:['user_id'],
  name:'accountMoneyLog',
  components: { control },
  data() {
    return {
      action_arr:[],
      value: "",
      brokerage: "",
      searchWhere: {
        title: "",
        status:'',
      },
      tableData: [],
      total: 0,
      current_page: 1,
      per_page: 14,
    };
  },
  mounted() {
    this.onSearch();
  },
  methods: {
        //分佣查询
    statusOptChange (status) {
      this.searchWhere.status = status
      this.onSearch()
    },
    // 查询
    handleSizeChange(val) {
      this.onSearch();
    },
    handleCurrentChange(val) {
      this.current_page = val;
      this.onSearch();
    },
    onSearch() {
      const form={user_id:this.user_id}
      form.page = this.current_page;
      this.get("/shop/Order/user_logs", form, "POST").then((e) => {
        this.tableData = e.list.data;
        this.per_page = e.list.per_page;
        this.total = e.list.total;
        this.current_page = e.list.current_page;
        this.action_arr = e.action_arr
      });
    },
  },
};
</script>

<style>
.layout-all {
  margin-top: 20px;
  margin-left: 10px;
}
.layout-content {
  margin-top: 20px;
}
</style>>
